<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="/jsp/ningbo/common.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="format-detection" content="address=no;">
    <title>在线申请</title>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/ningbo/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/ningbo/css/job.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
	<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.0/css/jquery-weui.min.css">
	<script src="<%=request.getContextPath()%>/jsp/ningbo/js/jquery-1.9.1.min.js"></script>
	<script src="//cdn.bootcss.com/jquery-weui/0.8.0/js/jquery-weui.min.js"></script>
</head>
<body>
	<%-- <!-- head start -->
    <header id="header">
            <span><a id="returnButton" onClick="javascript :window.history.back(); return false;"><img src="<%=request.getContextPath()%>/jsp/ningbo/images/arrow_return.png" width="28" height="28"></a></span>
            <h1>在线申请</h1>
    </header>
    <!-- head end -->
    <div class="mt50"></div> --%>
	<!-- form start -->
	<form id="cyform" action="<%=request.getContextPath()%>/nbwx/m/to_cy_zxsq" method="post">
    <div class="content">
    	<h5 class="tit_area">选择申报地点</h3>
        <ul class="list_form">
        	<li class="noline">
            	<span class="text">申报地点</span>
                <span class="select">
                <select id="qx_select" >
                	<option value="">请选择</option>
                </select>
                <select id="jd_select" >
                	<option value="">请选择</option>
                </select>
                街道(乡镇) <img src="<%=request.getContextPath()%>/jsp/ningbo/images/arrow_go.png">
                </span>
            </li>
        </ul>
        <div class="mid_btn">
            <a onclick="to_cy_zxsq()" class="btn btn-primary btn-block btn_blue">
              下一步
            </a>
        </div>
        <div class="prompt">
        	<h3>注意事项：</h3>
            <p>企业和个体工商户向营业执照经营所在地街道（乡镇）人力资源社保服务机构申报，未经工商注册登记的网络创业、村级电商，向户籍所在地街道（乡镇）人力社保服务机构申报。</p>
        </div>
    </div>	
    
    <input type="hidden" id="qxId">
    <input type="hidden" id="qxName">
    <input type="hidden" id="jdId">
    <input type="hidden" id="jdName">
    <input type="hidden" name="area_name" id="area_name">
    <input type="hidden" name="area_id" id="area_id">
    <!-- form end -->
    </form>
</body>
    <script type="text/javascript">
    
    	//选择宁波市区县街道产生联动效果
    	$("#qx_select").change(function (){
    		var qx = $("#qx_select").val();
    		var qxName = $("#qx_select").find("option:selected").text();
    		if(!(!qx)){
        		$("#qxId").val(qx);
        		$("#qxName").val(qxName);
    		}
    		var data = {};
    		data.lx='JB';
    		data.hm = qx;
    		data.area_level = '3';
    		data.type='1';
    		$.ajax({
    			url :ctxPath+'/nbwx/m/area_select.json',
    			type:'post',
    			data: data,
    			dataType:'html',
    			ifModified:true,
    			cache:false,
    			success:function(data){
    				data = $.parseJSON(data);
    				if (data.resultCode >=0){
    					var lists = data.model;
     					$("#jd_select").empty();	 
    					$("#jd_select").append("<option value=''>请选择</option>");	
    					$.each(lists,function(index,domEle){
    						var areaName;
    						var areaId;
    						 $.each(domEle,function(name,value){
    							
    							if ("AAB300"==name || "aab300"==name){
    								areaName=value;
    							}
    							if ("BSC001"==name || "bsc001"==name){
    								areaId=value;
    							}
    						})
    						$("#jd_select").append("<option value="+areaId+">"+areaName+"</option>");	
    					})
    				}
    				else{
    					alert("失败")
    				}
    			}
    		});
    		
    		
    	});
    	
    	
    	$("#jd_select").change(function (){
    		var jd = $("#qx_select").val();
    		var jdName = $("#jd_select").find("option:selected").text();
    		if(!(!jd)){
        		$("#jdId").val(jd);
        		$("#jdName").val(jdName);
    		}
    	});
    	
    	//跳转到在线申请提交页面
    	function to_cy_zxsq(){
    		var qxId = $("#qxId").val();
    		var qxName = $("#qxName").val();
    		var jdId = $("#qxId").val();
    		var jdName = $("#jdName").val();
    		var area_ID;
    		var area_name
    		
    		//如果街道id为空，区县id不为空，街道id为地域id
    		if((!jdId)&&(!(!qxId))){
    			area_id =qxId;
    			area_name = qxName;
    		}
    		if(!(!jdId)){
    			area_id =jdId;
    			area_name = qxName+" "+jdName;
    		}
    		if((!jdId)&&(!qxId)){
    			$.alert("请选择地区");
    			return;
    		}
			//2017/05/27修改街道乡镇判断跳转到在线申请提交页面
			if((!jdName)&&(!jdName)){
			$.alert("请选择街道乡镇");
			return;
			}
	//window.location.href=ctxPath+"/nbwx/m/to_cy_zxsq?area_name="+area_name+"&area_id="+area_id;
			$("#area_name").val(area_name);
			$("#area_id").val(area_id);
			$("#cyform")[0].submit();
    	}
    	
    	//页面加载时查询宁波市区县
    	window.onload = function (){  		
    		var data = {};
    		data.lx='JB';
    		data.hm = '00000001';
    		data.area_level = '2';
    		data.type='0';
    		$.ajax({
    			url :ctxPath+'/nbwx/m/area_select.json',
    			type:'post',
    			data: data,
    			dataType:'html',
    			ifModified:true,
    			cache:false,
    			success:function(data){
    				data = $.parseJSON(data);
    				if (data.resultCode >=0){
    					var lists = data.model;
     					$("#qx_select").empty();	 
    					$("#qx_select").append("<option value=''>请选择</option>");	
    					$.each(lists,function(index,domEle){
    						var areaName;
    						var areaId;
    						 $.each(domEle,function(name,value){
    							
    							if ("AAB300"==name || "aab300"==name){
    								areaName=value;
    							}
    							if ("BSC001"==name || "bsc001"==name){
    								areaId=value;
    							}
    						})
    						$("#qx_select").append("<option value="+areaId+">"+areaName+"</option>");	
    					})
    				}
    				else{
    					$.alert("失败");
    				}
    			}
    		});
    	}
    </script>
</html>